// import axios from "axios";
// import * as qs from "qs";
import * as Config from "@/config/index";
import { post,get } from "../httpRequest";

/**
 * @Author: GuoXinyuan
 * @Date: 2021/5/28
 *
 * 用户登录/注册相关API
 * ！！！http请求需要调用 httpRequest下方法 其中封装了登录状态检测逻辑
 */

const BASE_URI = Config.HTTP_SERVER + "/identify";

/**
 * 登录API
 * @param data
 * @param success
 * @param error
 * @param final
 */
export function loginAPI(data, success, error, final){
  post(BASE_URI + "/login", data, success, error, final);
}

/**
 * 获取当前用户
 * @param data
 * @param success
 * @param error
 * @param final
 */
export function getCurrengUser(success, error, final) {
  get(BASE_URI + "/currentUser", success, error, final);
}


/**
 * 注册API
 * @param data
 * @param success
 * @param error
 * @param final
 */
export function registerAPI(data, success, error, final){
  post(BASE_URI + "/register",data,success,error,final);
}

/**
 * 用户注销
 * @param data
 * @param success
 * @param error
 * @param final
 */
export function logoutAPI( success, error, final){
  get(BASE_URI + "/logout",success,error,final);
}
